Full source code website bán hàng thương mại điện tử gần giống shopee
468.799 lượt xem;
1 <link type="text/css" href="css/jquery.datepick.css" rel="stylesheet">
2 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
3 <script type="text/javascript" src="css/jquery.datepick.js"></script>
4 <script type="text/javascript">
5 $(function() {
6 $('#popupDatepicker').datepick();
7 $('#inlineDatepicker').datepick({onSelect: showDate});
8 $('#popupDatepicker1').datepick();
9 $('#inlineDatepicker').datepick({onSelect: showDate});
10 });
11
12 function showDate(date) {
13 alert('The date chosen is ' + date);
14 }
15 </script>
16 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
17 <tr><td width="45%" height="20" align="center" class="title">
18 Lịch sử thanh toán hoa hồng
19 </td></tr>
20 <tr><td>
21 <?
22 switch ($_GET['action'])
23 {
24 case 'del' :
25 $id = $_GET['id'];
26 $sql1="select * from user_shop where id=$id limit 1";
27 $pro=mysql_fetch_assoc(mysql_query($sql1,$con));
28
29 $sql2="select * from products where user='".$pro['user']."' ";
30 $pro2=mysql_fetch_assoc(mysql_query($sql2,$con));
31
32 $sql3="select * from slider_show where user='".$pro['user']."' ";
33 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
34
35 $sql4="select * from ads_mem where user='".$pro['user']."' ";
36 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
37
38 $sql5="select * from cat_mem where user='".$pro['user']."' ";
39 $pro5=mysql_fetch_assoc(mysql_query($sql5,$con));
40
41 $sql = "delete from user_shop where id='".$id."'";
42 @$result = mysql_query($sql,$con);
43 if ($result)
44 {
45 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
46 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
47 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
48
49 mysql_query("delete from products where user='".$pro['user']."'",$con);
50 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
51 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
52 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
53 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
54 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
55 mysql_query("delete from contact where user='".$pro['user']."'",$con);
56 mysql_query("delete from support_mem where user='".$pro['user']."'",$con);
57
58 if (file_exists("../".$pro2['image'])) unlink("../".$pro2['image']);
59 if (file_exists("../".$pro2['image_large'])) unlink("../".$pro2['image_large']);
60
61 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
62
63 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
64 echo "<p align=center class='err'>Đã xóa thành công </p>".$pro['user'];
65 }
66 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
67 break;
68 }
69 ?>
70
71 <?
72 if (isset($_POST['ButDel'])) {
73 $cnt=0;
74 foreach ($_POST['chk'] as $id)
75 {
76 $sql="select * from user_shop where id=$id limit 1";
77 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
78
79 $sql3="select * from slider_show where user='".$pro['user']."' ";
80 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
81 $sql4="select * from ads_mem where user='".$pro['user']."' ";
82 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
83 @$result = mysql_query("delete from user_shop where id='".$id."'",$con);
84 if ($result)
85 {
86 $cnt++;
87 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
88 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
89 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
90
91 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
92 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
93 mysql_query("delete from products where user='".$pro['user']."'",$con);
94 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
95 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
96 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
97 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
98 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
99 mysql_query("delete from contact where user='".$pro['user']."'",$con);
100 }
101 }
102 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
103 }
104 ?>
105 <?
106 if (isset($_POST['pay'])) {
107 $cnt=0;
108 foreach ($_POST['chk'] as $id)
109 {
110 $sql="select * from user_shop where id=$id limit 1";
111 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
112 @$result = mysql_query("update user_shop set active=1,hoahong_time='".strtotime(str_replace("/","-",date("d/m/Y")))."' where id='".$id."' and active=0 and level_shop=0",$con);
113 if ($result)
114 {
115 $cnt++;
116 }
117 }
118 echo "<p align=center class='err'>Đã thanh toán hoa hồng với ".$cnt." thành viên</p>";
119 }
120 ?>
121 <?
122 $page = $_GET["page"];
123 $MAXPAGE=50;
124 $p=0;
125 if ($page!='') $p=$page;
126 ?>
127 <input type=hidden name="page" value="<? echo $page; ?>">
128 <?
129 function taotrang($sql,$link,$nitem,$itemcurrent)
130 { global $con;
131 $ret="";
132 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
133 $value = mysql_fetch_array($result);
134 $plus = (($value['cnt'] % $nitem)>0);
135 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
136 {
137 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
138 else $ret .= ($i+1)." ";
139 }
140 return $ret;
141 }
142 $pageindex=taotrang("select count(*) from user_shop","./?act=users"."&page=",$MAXPAGE,$page);
143 ?>
144 <table cellspacing="0" cellpadding="0">
145 <tr>
146 <td>Trang : <? echo $pageindex; ?></td>
147 </tr>
148 </table>
149 <table cellspacing="0" cellpadding="0">
150 <tr>
151 <td>Tìm kiếm: </td>
152 <td>
153 <!-- begin tim kiem-->
154 <form name="form_select" method="GET" action="./">
155 <input type="hidden" name="act" value="users_pay" />
156 <input type="hidden" name="search" value="search" />
157 <table id="timkiem_home" border="0" id="table21" cellspacing="0" cellpadding="0">
158 <tr>
159 <td>
160 Ten site: <input name="keywords" type="text" id="input_timkiem" value="">
161 </td>
162 <td width="300">
163 Thành viên giới thiệu:
164 <select name="nhom">
165 <?php
166 $queryd = "SELECT id,reg_user,user, COUNT(user) FROM user_shop GROUP BY reg_user";
167 $resultd = mysql_query($queryd) or die(mysql_error());
168 while($rowd = mysql_fetch_array($resultd)){
169 ?>
170 <?php if($rowd['reg_user']=='')
171 {?>
172 <option value="" selected>-- Chọn tất cả --</option>
173 <?}else{?>
174 <?php if($rowd['reg_user']==$_REQUEST['nhom'])
175 {?>
176 <option value="<? echo $rowd['reg_user'];?>" selected><? echo $rowd['reg_user'];?></option>
177 <?}else{?>
178 <option value="<? echo $rowd['reg_user'];?>"><? echo $rowd['reg_user'];?></option>
179 <?}?>
180 <?}?>
181 <?}
182 ?>
183 </select>
184 </td>
185 </tr></table>
186 <table>
187 <tr>
188 <td style="width:270px">
189 <div>Thời gian
190 <input type="text" name="date" id="popupDatepicker" value="<?php echo $_REQUEST['date'];?>">
191 </div>
192 </td>
193 <td style="width:250px">
194 <div>đến
195 <input type="text" name="date2" id="popupDatepicker1" value="<?php echo $_REQUEST['date2'];?>">
196 </div>
197 </td>
198 </tr>
199 </tr>
200 <td colspan="5" style="padding-top:10px;text-align:center">
201 <input type="reset" class="button" value="Bỏ lọc" />
202 <input type="submit" class="button" name="timkiem" value="Tìm kiếm" />
203 </td>
204 </tr>
205 </table>
206 </form>
207 <!-- end tim kiem -->
208 </td>
209 </tr>
210 </table>
211
212
213 <tr><td>
214 <!-- begin danh sach -->
215 <form method="POST" action="" name="frmList">
216 <table border="1" cellpadding="2" style="border-collapse: collapse;font-size:12px" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
217 <tr class="title">
218 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
219 <td nowrap class="title"> </td>
220 <td nowrap class="title"> </td>
221 <td nowrap class="title"> </td>
222 <td>ID</td>
223 <td>User</td>
224 <td>Người giới thiệu</td>
225 <td>Ngày đăng ký</td>
226 <td>Ngày kích hoạt Vip </td>
227 <td><a href="<?php echo $_SERVER['REQUEST_URI'];?>&by=end_time&order=desc">Ngày hết hạn </td>
228 <td>Ngày T.Toán</td>
229 <td>Status</td>
230 <td>Level</td>
231 <td>Tiền nộp</td>
232 <td>Hoa hồng</td>
233 <td>Tổng Hoa hồng</td>
234 </tr>
235 <?php if($_REQUEST['search']=='')
236 {?>
237 <?
238 if($_REQUEST['by']=='')
239 {
240 $by="id";
241 }
242 else
243 {
244 $by=$_REQUEST['by'];
245 }
246 if($_REQUEST['order']=='')
247 {
248 $order="desc";
249 }
250 else
251 {
252 $order=$_REQUEST['order'];
253 }
254 $sql=mysql_query("SELECT * FROM user_shop where active=1 order by ".$by." ".$order." limit ".($p*$MAXPAGE).",".$MAXPAGE);
255 $i=0;
256 while($row=mysql_fetch_array($sql))
257 {
258 $i++;
259 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
260 $chietkhau=$chietkhau+$row['chietkhau'];
261 $chietkhau1=0;
262 $tien=$tien+$row['tien'];
263 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
264 $row_reg=mysql_fetch_assoc($sql_reg);
265 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
266 while($row_ck=mysql_fetch_array($sql_ck))
267 {
268 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
269 }
270 ?>
271
272 <tr bgcolor="<? echo $color;?>" class="table_a">
273 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
274 <td width="20">
275 <INPUT type="button" value="Xem" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
276 <td width="20">
277 <a href="./?act=users_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
278 Sửa</a></td>
279 <td width="20">
280 <a href="./?act=users&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
281 Xoá</a></td>
282 <td><? echo $row['id'];?></td>
283 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
284 <td>
285 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Full name: </td><td style=\"width:400px\"><? echo $row_reg['fullname'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Mobile: </td><td><? echo $row_reg['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Company: </td><td><? echo $row_reg['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Address: </td><td><? echo $row_reg['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['reg_user']; ?>" target="_blank">
286 <font color="blue"><? echo $row['reg_user']; ?></b></font>
287 </a>
288 </td>
289 <td><? echo date("d/m/Y",$row['re_time']);?></td>
290 <td><? echo date("d/m/Y",$row['pay_time']);?></td>
291 <td><? echo date("d/m/Y",$row['end_time']);?></td>
292 <td style="color:red"><? echo date("d/m/Y",$row['hoahong_time']);?></td>
293 <td>
294 <?php if($row['active']=='0')
295 {?>
296 <font color="red"><b>No</b></font>
297 <?}else{?>
298 <font color="blue"><b>Yes</b></font>
299 <?}?>
300 </td>
301 <td><? if($row['level_shop']==0) echo "<font color=red>Vip</font>";
302 elseif($row['level_shop']==3) echo "<font color=blue>Free</font>";
303 elseif($row['level_shop']==1) echo "<font color=blue>Unactive</font>";
304 else echo "<font color=blue>Member</font>";
305 ?></td>
306 <td><? echo number_format($row['tien'],0);?></td>
307 <td><? echo number_format($row['chietkhau'],0);?></td>
308 <td><? echo number_format($chietkhau1,0);?></td>
309 </tr>
310 <?}?>
311 <tr>
312 <td colspan="13" align="center" style="font-weight:bold;color:blue">
313 Tổng số
314 </td>
315 <td>
316 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($tien,0);?> VNĐ</b></font></div>
317 </td>
318 <td>
319 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
320 </td>
321 <td>
322 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
323 </td>
324 </tr>
325 </table>
326 <!-- end danh sach -->
327
328
329
330 </td></tr>
331 </table>
332 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
333 </form>
334 <?}else{?>
335 <?
336 $where="1=1";
337 $keywords=killInjection($_REQUEST['keywords']);
338 if ($keywords!='')
339 {
340 $where.=" and (mieuta like '%".$keywords."%' or title like '%".$keywords."%'";
341 if ($_REQUEST['search_in_description']=='')
342 $where.="or user like '%".$keywords."%' or company like '%".$keywords."%' or address like '%".$keywords."%' ";
343 $where.=") ";
344 }
345 if ($_REQUEST['cat_id']!='') $where.=" and cat_mem=".$_REQUEST['cat_id'];
346 if ($_REQUEST['level']!='') $where.=" and level_shop=".$_REQUEST['level'];
347 if ($_REQUEST['status']!='') $where.=" and active=".$_REQUEST['status'];
348 if ($_REQUEST['date']!='') $where.=" and re_time>=".strtotime(str_replace("/","-",$_REQUEST['date']));
349 if ($_REQUEST['date2']!='') $where.=" and re_time<=".strtotime(str_replace("/","-",$_REQUEST['date2']));
350
351 $MAXPAGE=50;
352 $p=0;
353 if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
354 if ($_REQUEST['nhom']=='')
355 {
356 $nhom="";
357 }
358 else
359 {
360 $nhom="and reg_user='".$_REQUEST['nhom']."'";
361 }
362 $sql="select * from user_shop where $where $nhom and active=1 limit ".$p*$MAXPAGE.",".$MAXPAGE;
363 $result = mysql_query($sql,$con);
364 $tien=0;
365 $chietkhau=0;
366 $i=0;
367 while (($row=mysql_fetch_assoc($result)))
368 {
369 $i++;
370 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
371 $tien=$tien+$row['tien'];
372 $chietkhau=$chietkhau+$row['chietkhau'];
373 $chietkhau1=0;
374 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
375 $row_reg=mysql_fetch_assoc($sql_reg);
376 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
377 while($row_ck=mysql_fetch_array($sql_ck))
378 {
379 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
380 }
381 ?>
382 <tr bgcolor="<? echo $color;?>" class="table_a">
383 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
384 <td width="20">
385 <INPUT type="button" value="Xem" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
386 <td width="20">
387 <a href="./?act=users_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
388 Sửa</a></td>
389 <td width="20">
390 <a href="./?act=users&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
391 Xoá</a></td>
392 <td><? echo $row['id'];?></td>
393 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
394 <td>
395 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Full name: </td><td style=\"width:400px\"><? echo $row_reg['fullname'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Mobile: </td><td><? echo $row_reg['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Company: </td><td><? echo $row_reg['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Address: </td><td><? echo $row_reg['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['reg_user']; ?>" target="_blank">
396 <font color="blue"><? echo $row['reg_user']; ?></b></font>
397 </a>
398 </td>
399 <td><? echo date("d/m/Y",$row['re_time']);?></td>
400 <td><? echo date("d/m/Y",$row['pay_time']);?></td>
401 <td><? echo date("d/m/Y",$row['end_time']);?></td>
402 <td style="color:red"><? echo date("d/m/Y",$row['hoahong_time']);?></td>
403 <td>
404 <?php if($row['active']=='0')
405 {?>
406 <font color="red"><b>No</b></font>
407 <?}else{?>
408 <font color="blue"><b>Yes</b></font>
409 <?}?>
410 </td>
411 <td><? if($row['level_shop']==0) echo "<font color=red>Vip</font>";
412 elseif($row['level_shop']==3) echo "<font color=blue>Free</font>";
413 elseif($row['level_shop']==1) echo "<font color=blue>Unactive</font>";
414 else echo "<font color=blue>Member</font>";
415 ?></td>
416 <td><? echo number_format($row['tien'],0);?></td>
417 <td><? echo number_format($row['chietkhau'],0);?></td>
418 <td><? echo number_format($chietkhau1,0);?></td>
419 </tr>
420 <?}
421 settype($total[0],int);
422 ?>
423 <tr>
424 <td colspan="13" align="center" style="font-weight:bold;color:blue">
425 Tổng số
426 </td>
427 <td>
428 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($tien,0);?> VNĐ</b></font></div>
429 </td>
430 <td>
431 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
432 </td>
433 <td>
434 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
435 </td>
436 </tr>
437 </table>
438 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
439 <tr><td colspan="2" height="7"></td></tr>
440 <tr>
441 <td>
442 </td>
443
444
445
446 <td align="right">
447 </td>
448
449
450 </tr>
451 </table>
452 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
453 <input type="submit" value="Thanh toán hoa hồng" name="pay" onclick="return confirm('Bạn có đồng ý thanh toán hoa hồng không?');" class="button">
454 </form>
455 <?}?>
456 <script language="JavaScript">
457 function chkallClick(o) {
458 var form = document.frmList;
459 for (var i = 0; i < form.elements.length; i++) {
460 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
461 form.elements[i].checked = document.frmList.chkall.checked;
462 }
463 }
464 }
465 </script>
2 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
3 <script type="text/javascript" src="css/jquery.datepick.js"></script>
4 <script type="text/javascript">
5 $(function() {
6 $('#popupDatepicker').datepick();
7 $('#inlineDatepicker').datepick({onSelect: showDate});
8 $('#popupDatepicker1').datepick();
9 $('#inlineDatepicker').datepick({onSelect: showDate});
10 });
11
12 function showDate(date) {
13 alert('The date chosen is ' + date);
14 }
15 </script>
16 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
17 <tr><td width="45%" height="20" align="center" class="title">
18 Lịch sử thanh toán hoa hồng
19 </td></tr>
20 <tr><td>
21 <?
22 switch ($_GET['action'])
23 {
24 case 'del' :
25 $id = $_GET['id'];
26 $sql1="select * from user_shop where id=$id limit 1";
27 $pro=mysql_fetch_assoc(mysql_query($sql1,$con));
28
29 $sql2="select * from products where user='".$pro['user']."' ";
30 $pro2=mysql_fetch_assoc(mysql_query($sql2,$con));
31
32 $sql3="select * from slider_show where user='".$pro['user']."' ";
33 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
34
35 $sql4="select * from ads_mem where user='".$pro['user']."' ";
36 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
37
38 $sql5="select * from cat_mem where user='".$pro['user']."' ";
39 $pro5=mysql_fetch_assoc(mysql_query($sql5,$con));
40
41 $sql = "delete from user_shop where id='".$id."'";
42 @$result = mysql_query($sql,$con);
43 if ($result)
44 {
45 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
46 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
47 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
48
49 mysql_query("delete from products where user='".$pro['user']."'",$con);
50 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
51 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
52 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
53 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
54 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
55 mysql_query("delete from contact where user='".$pro['user']."'",$con);
56 mysql_query("delete from support_mem where user='".$pro['user']."'",$con);
57
58 if (file_exists("../".$pro2['image'])) unlink("../".$pro2['image']);
59 if (file_exists("../".$pro2['image_large'])) unlink("../".$pro2['image_large']);
60
61 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
62
63 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
64 echo "<p align=center class='err'>Đã xóa thành công </p>".$pro['user'];
65 }
66 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
67 break;
68 }
69 ?>
70
71 <?
72 if (isset($_POST['ButDel'])) {
73 $cnt=0;
74 foreach ($_POST['chk'] as $id)
75 {
76 $sql="select * from user_shop where id=$id limit 1";
77 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
78
79 $sql3="select * from slider_show where user='".$pro['user']."' ";
80 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
81 $sql4="select * from ads_mem where user='".$pro['user']."' ";
82 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
83 @$result = mysql_query("delete from user_shop where id='".$id."'",$con);
84 if ($result)
85 {
86 $cnt++;
87 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
88 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
89 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
90
91 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
92 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
93 mysql_query("delete from products where user='".$pro['user']."'",$con);
94 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
95 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
96 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
97 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
98 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
99 mysql_query("delete from contact where user='".$pro['user']."'",$con);
100 }
101 }
102 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
103 }
104 ?>
105 <?
106 if (isset($_POST['pay'])) {
107 $cnt=0;
108 foreach ($_POST['chk'] as $id)
109 {
110 $sql="select * from user_shop where id=$id limit 1";
111 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
112 @$result = mysql_query("update user_shop set active=1,hoahong_time='".strtotime(str_replace("/","-",date("d/m/Y")))."' where id='".$id."' and active=0 and level_shop=0",$con);
113 if ($result)
114 {
115 $cnt++;
116 }
117 }
118 echo "<p align=center class='err'>Đã thanh toán hoa hồng với ".$cnt." thành viên</p>";
119 }
120 ?>
121 <?
122 $page = $_GET["page"];
123 $MAXPAGE=50;
124 $p=0;
125 if ($page!='') $p=$page;
126 ?>
127 <input type=hidden name="page" value="<? echo $page; ?>">
128 <?
129 function taotrang($sql,$link,$nitem,$itemcurrent)
130 { global $con;
131 $ret="";
132 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
133 $value = mysql_fetch_array($result);
134 $plus = (($value['cnt'] % $nitem)>0);
135 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
136 {
137 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
138 else $ret .= ($i+1)." ";
139 }
140 return $ret;
141 }
142 $pageindex=taotrang("select count(*) from user_shop","./?act=users"."&page=",$MAXPAGE,$page);
143 ?>
144 <table cellspacing="0" cellpadding="0">
145 <tr>
146 <td>Trang : <? echo $pageindex; ?></td>
147 </tr>
148 </table>
149 <table cellspacing="0" cellpadding="0">
150 <tr>
151 <td>Tìm kiếm: </td>
152 <td>
153 <!-- begin tim kiem-->
154 <form name="form_select" method="GET" action="./">
155 <input type="hidden" name="act" value="users_pay" />
156 <input type="hidden" name="search" value="search" />
157 <table id="timkiem_home" border="0" id="table21" cellspacing="0" cellpadding="0">
158 <tr>
159 <td>
160 Ten site: <input name="keywords" type="text" id="input_timkiem" value="">
161 </td>
162 <td width="300">
163 Thành viên giới thiệu:
164 <select name="nhom">
165 <?php
166 $queryd = "SELECT id,reg_user,user, COUNT(user) FROM user_shop GROUP BY reg_user";
167 $resultd = mysql_query($queryd) or die(mysql_error());
168 while($rowd = mysql_fetch_array($resultd)){
169 ?>
170 <?php if($rowd['reg_user']=='')
171 {?>
172 <option value="" selected>-- Chọn tất cả --</option>
173 <?}else{?>
174 <?php if($rowd['reg_user']==$_REQUEST['nhom'])
175 {?>
176 <option value="<? echo $rowd['reg_user'];?>" selected><? echo $rowd['reg_user'];?></option>
177 <?}else{?>
178 <option value="<? echo $rowd['reg_user'];?>"><? echo $rowd['reg_user'];?></option>
179 <?}?>
180 <?}?>
181 <?}
182 ?>
183 </select>
184 </td>
185 </tr></table>
186 <table>
187 <tr>
188 <td style="width:270px">
189 <div>Thời gian
190 <input type="text" name="date" id="popupDatepicker" value="<?php echo $_REQUEST['date'];?>">
191 </div>
192 </td>
193 <td style="width:250px">
194 <div>đến
195 <input type="text" name="date2" id="popupDatepicker1" value="<?php echo $_REQUEST['date2'];?>">
196 </div>
197 </td>
198 </tr>
199 </tr>
200 <td colspan="5" style="padding-top:10px;text-align:center">
201 <input type="reset" class="button" value="Bỏ lọc" />
202 <input type="submit" class="button" name="timkiem" value="Tìm kiếm" />
203 </td>
204 </tr>
205 </table>
206 </form>
207 <!-- end tim kiem -->
208 </td>
209 </tr>
210 </table>
211
212
213 <tr><td>
214 <!-- begin danh sach -->
215 <form method="POST" action="" name="frmList">
216 <table border="1" cellpadding="2" style="border-collapse: collapse;font-size:12px" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
217 <tr class="title">
218 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
219 <td nowrap class="title"> </td>
220 <td nowrap class="title"> </td>
221 <td nowrap class="title"> </td>
222 <td>ID</td>
223 <td>User</td>
224 <td>Người giới thiệu</td>
225 <td>Ngày đăng ký</td>
226 <td>Ngày kích hoạt Vip </td>
227 <td><a href="<?php echo $_SERVER['REQUEST_URI'];?>&by=end_time&order=desc">Ngày hết hạn </td>
228 <td>Ngày T.Toán</td>
229 <td>Status</td>
230 <td>Level</td>
231 <td>Tiền nộp</td>
232 <td>Hoa hồng</td>
233 <td>Tổng Hoa hồng</td>
234 </tr>
235 <?php if($_REQUEST['search']=='')
236 {?>
237 <?
238 if($_REQUEST['by']=='')
239 {
240 $by="id";
241 }
242 else
243 {
244 $by=$_REQUEST['by'];
245 }
246 if($_REQUEST['order']=='')
247 {
248 $order="desc";
249 }
250 else
251 {
252 $order=$_REQUEST['order'];
253 }
254 $sql=mysql_query("SELECT * FROM user_shop where active=1 order by ".$by." ".$order." limit ".($p*$MAXPAGE).",".$MAXPAGE);
255 $i=0;
256 while($row=mysql_fetch_array($sql))
257 {
258 $i++;
259 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
260 $chietkhau=$chietkhau+$row['chietkhau'];
261 $chietkhau1=0;
262 $tien=$tien+$row['tien'];
263 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
264 $row_reg=mysql_fetch_assoc($sql_reg);
265 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
266 while($row_ck=mysql_fetch_array($sql_ck))
267 {
268 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
269 }
270 ?>
271
272 <tr bgcolor="<? echo $color;?>" class="table_a">
273 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
274 <td width="20">
275 <INPUT type="button" value="Xem" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
276 <td width="20">
277 <a href="./?act=users_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
278 Sửa</a></td>
279 <td width="20">
280 <a href="./?act=users&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
281 Xoá</a></td>
282 <td><? echo $row['id'];?></td>
283 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
284 <td>
285 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Full name: </td><td style=\"width:400px\"><? echo $row_reg['fullname'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Mobile: </td><td><? echo $row_reg['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Company: </td><td><? echo $row_reg['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Address: </td><td><? echo $row_reg['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['reg_user']; ?>" target="_blank">
286 <font color="blue"><? echo $row['reg_user']; ?></b></font>
287 </a>
288 </td>
289 <td><? echo date("d/m/Y",$row['re_time']);?></td>
290 <td><? echo date("d/m/Y",$row['pay_time']);?></td>
291 <td><? echo date("d/m/Y",$row['end_time']);?></td>
292 <td style="color:red"><? echo date("d/m/Y",$row['hoahong_time']);?></td>
293 <td>
294 <?php if($row['active']=='0')
295 {?>
296 <font color="red"><b>No</b></font>
297 <?}else{?>
298 <font color="blue"><b>Yes</b></font>
299 <?}?>
300 </td>
301 <td><? if($row['level_shop']==0) echo "<font color=red>Vip</font>";
302 elseif($row['level_shop']==3) echo "<font color=blue>Free</font>";
303 elseif($row['level_shop']==1) echo "<font color=blue>Unactive</font>";
304 else echo "<font color=blue>Member</font>";
305 ?></td>
306 <td><? echo number_format($row['tien'],0);?></td>
307 <td><? echo number_format($row['chietkhau'],0);?></td>
308 <td><? echo number_format($chietkhau1,0);?></td>
309 </tr>
310 <?}?>
311 <tr>
312 <td colspan="13" align="center" style="font-weight:bold;color:blue">
313 Tổng số
314 </td>
315 <td>
316 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($tien,0);?> VNĐ</b></font></div>
317 </td>
318 <td>
319 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
320 </td>
321 <td>
322 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
323 </td>
324 </tr>
325 </table>
326 <!-- end danh sach -->
327
328
329
330 </td></tr>
331 </table>
332 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
333 </form>
334 <?}else{?>
335 <?
336 $where="1=1";
337 $keywords=killInjection($_REQUEST['keywords']);
338 if ($keywords!='')
339 {
340 $where.=" and (mieuta like '%".$keywords."%' or title like '%".$keywords."%'";
341 if ($_REQUEST['search_in_description']=='')
342 $where.="or user like '%".$keywords."%' or company like '%".$keywords."%' or address like '%".$keywords."%' ";
343 $where.=") ";
344 }
345 if ($_REQUEST['cat_id']!='') $where.=" and cat_mem=".$_REQUEST['cat_id'];
346 if ($_REQUEST['level']!='') $where.=" and level_shop=".$_REQUEST['level'];
347 if ($_REQUEST['status']!='') $where.=" and active=".$_REQUEST['status'];
348 if ($_REQUEST['date']!='') $where.=" and re_time>=".strtotime(str_replace("/","-",$_REQUEST['date']));
349 if ($_REQUEST['date2']!='') $where.=" and re_time<=".strtotime(str_replace("/","-",$_REQUEST['date2']));
350
351 $MAXPAGE=50;
352 $p=0;
353 if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
354 if ($_REQUEST['nhom']=='')
355 {
356 $nhom="";
357 }
358 else
359 {
360 $nhom="and reg_user='".$_REQUEST['nhom']."'";
361 }
362 $sql="select * from user_shop where $where $nhom and active=1 limit ".$p*$MAXPAGE.",".$MAXPAGE;
363 $result = mysql_query($sql,$con);
364 $tien=0;
365 $chietkhau=0;
366 $i=0;
367 while (($row=mysql_fetch_assoc($result)))
368 {
369 $i++;
370 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
371 $tien=$tien+$row['tien'];
372 $chietkhau=$chietkhau+$row['chietkhau'];
373 $chietkhau1=0;
374 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
375 $row_reg=mysql_fetch_assoc($sql_reg);
376 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
377 while($row_ck=mysql_fetch_array($sql_ck))
378 {
379 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
380 }
381 ?>
382 <tr bgcolor="<? echo $color;?>" class="table_a">
383 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
384 <td width="20">
385 <INPUT type="button" value="Xem" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
386 <td width="20">
387 <a href="./?act=users_add&cat=<? echo $_REQUEST['cat']; ?>&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
388 Sửa</a></td>
389 <td width="20">
390 <a href="./?act=users&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['id']; ?>">
391 Xoá</a></td>
392 <td><? echo $row['id'];?></td>
393 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
394 <td>
395 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Full name: </td><td style=\"width:400px\"><? echo $row_reg['fullname'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Mobile: </td><td><? echo $row_reg['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Company: </td><td><? echo $row_reg['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Address: </td><td><? echo $row_reg['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['reg_user']; ?>" target="_blank">
396 <font color="blue"><? echo $row['reg_user']; ?></b></font>
397 </a>
398 </td>
399 <td><? echo date("d/m/Y",$row['re_time']);?></td>
400 <td><? echo date("d/m/Y",$row['pay_time']);?></td>
401 <td><? echo date("d/m/Y",$row['end_time']);?></td>
402 <td style="color:red"><? echo date("d/m/Y",$row['hoahong_time']);?></td>
403 <td>
404 <?php if($row['active']=='0')
405 {?>
406 <font color="red"><b>No</b></font>
407 <?}else{?>
408 <font color="blue"><b>Yes</b></font>
409 <?}?>
410 </td>
411 <td><? if($row['level_shop']==0) echo "<font color=red>Vip</font>";
412 elseif($row['level_shop']==3) echo "<font color=blue>Free</font>";
413 elseif($row['level_shop']==1) echo "<font color=blue>Unactive</font>";
414 else echo "<font color=blue>Member</font>";
415 ?></td>
416 <td><? echo number_format($row['tien'],0);?></td>
417 <td><? echo number_format($row['chietkhau'],0);?></td>
418 <td><? echo number_format($chietkhau1,0);?></td>
419 </tr>
420 <?}
421 settype($total[0],int);
422 ?>
423 <tr>
424 <td colspan="13" align="center" style="font-weight:bold;color:blue">
425 Tổng số
426 </td>
427 <td>
428 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($tien,0);?> VNĐ</b></font></div>
429 </td>
430 <td>
431 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
432 </td>
433 <td>
434 <div style="float:right;padding-right:16px"> <font color="red"><b><? echo number_format($chietkhau,0);?> VNĐ</b></font></div>
435 </td>
436 </tr>
437 </table>
438 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
439 <tr><td colspan="2" height="7"></td></tr>
440 <tr>
441 <td>
442 </td>
443
444
445
446 <td align="right">
447 </td>
448
449
450 </tr>
451 </table>
452 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
453 <input type="submit" value="Thanh toán hoa hồng" name="pay" onclick="return confirm('Bạn có đồng ý thanh toán hoa hồng không?');" class="button">
454 </form>
455 <?}?>
456 <script language="JavaScript">
457 function chkallClick(o) {
458 var form = document.frmList;
459 for (var i = 0; i < form.elements.length; i++) {
460 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
461 form.elements[i].checked = document.frmList.chkall.checked;
462 }
463 }
464 }
465 </script>